import json


def convert_dataset():
    new_data = {
        "type": "text_only",
        "instances": []
    }
    with open("/liub/zyf/Fine-tuning/LMFlow-1.0.0/data/winogrande_l/train/1.arrow_to_json.json", 'r') as f:
        for line in f:
            data = json.loads(line)
            text_content = f"sentence: {data['sentence']} option1: {data['option1']} option2: {data['option2']} answer: {data['answer']}"
            instance = {
                "text": text_content
            }
            new_data["instances"].append(instance)

    with open('new_dataset.json', 'w') as f:
        json.dump(new_data, f, indent=4)


if __name__ == "__main__":
    convert_dataset()
